package com.imooc.cpp.controller;

import com.imooc.cpp.dto.Response;
import com.imooc.cpp.entity.Chapter;
import com.imooc.cpp.service.ChapterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class ChapterController {

    @Resource
    private ChapterService chapterService;
    
    @PostMapping("/publish")
    public Response publish(@RequestBody Chapter chapter){
        chapterService.publish(chapter);
        return new Response("200","SUCCESS");
    }

}
